package com.weirong.smartvault.dao;

import com.weirong.smartvault.entity.ForeignCurrencyRequest;
import com.weirong.smartvault.entity.Stock;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.List;

@Repository
@Qualifier("foreignCurrencyRequestRepository")
public interface ForeignCurrencyRequestRepository extends JpaRepository<ForeignCurrencyRequest, Integer> ,JpaSpecificationExecutor<ForeignCurrencyRequest> {

    @Query("SELECT request FROM ForeignCurrencyRequest request WHERE request.requestDate >= :beginDate and request.requestDate <= :endDate")
    public List<ForeignCurrencyRequest> getRequestByRequestDate(@Param("beginDate") Timestamp beginDate, @Param("endDate") Timestamp endDate);

}